//
//  BEMainTabBarController.swift
//  BEGlobalOiler
//
//  Created by KKING on 16/7/25.
//  Copyright © 2016年 Bullseye Energy pte ltd. All rights reserved.
//

import UIKit

class BEMainTabBarController: UITabBarController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = COLOR_ALL_BG
        addChildControllers()
    }
    
    
    fileprivate func addChildControllers() {
        
        addChildViewController("Home", imageName: "tabbar_home", Vc: BEHomeController())
        addChildViewController("My orders", imageName: "tabbar_myorders", Vc: BEMyOrdersListController())
//        addChildViewController("Contact", imageName: "tabbar_contact", Vc: BEContactController())
        addChildViewController("Messages", imageName: "tabbar_message", Vc: BEMessageController())
    }
    
    fileprivate func addChildViewController(_ title:String?,imageName:String?,Vc:UIViewController) {
        Vc.title = title
        
        Vc.tabBarItem.image = UIImage(named: imageName ?? "")?.withRenderingMode(.alwaysOriginal)
        Vc.tabBarItem.selectedImage = UIImage(named: imageName! + "_selected")?.withRenderingMode(.alwaysOriginal)
        Vc.tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3)

        Vc.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: COLOR_NAV_ITEM_NORMAL], for: .selected)
        
        let navc = KKNavigationViewController(rootViewController: Vc)
        addChildViewController(navc)
    }
    
    
}
